package h0807;

import java.util.*;

public class PrintTaskSort3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] priorities = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();
        List<int[]> list=new ArrayList<>();
        for (int i = 0; i < priorities.length; i++) {
            list.add(new int[]{priorities[i],i}); //这里存放原始的元素值和原始的位置
        }
        getRes(priorities,list);
    }

    private static void getRes(int[] priorities, List<int[]> list) {
        Arrays.sort(priorities);
        int idx= priorities.length-1;

        LinkedList<int[]> queue=new LinkedList<>(list);
        int[] ans = new int[priorities.length];
        int ansSort=0;
        while (!queue.isEmpty()){
            int[] arr = queue.removeFirst();
            if (arr[0]==priorities[idx]){
                //ans[0]=0; ans[2]=1;ans[1]=2;  如果是9,3,5 ans[原始下标]=
                ans[arr[1]]=ansSort;
                ansSort++; //序号++
                idx--;  //优先级数组往前移动一个
            }else {
                //不满足，将该数组添加到末尾
                queue.addLast(arr);
            }
        }
        StringJoiner joiner=new StringJoiner(",");
        for (int a : ans) {
            joiner.add(a+"");
        }
        System.out.println(joiner);
    }
}
